package com.blb.search_service.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@AllArgsConstructor
@NoArgsConstructor
//配置indexName索引名称，type是类型名称，shards是分片数，replicas是副本数
@Document(indexName = "goods",type = "_doc",shards = 1,replicas = 0)
public class Goods {

    @Id
    private Long id;

    //配置字段，type是类型，analyzer是分词器，index是否索引
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String name;

    @Field(type = FieldType.Keyword)
    private String brand;

    @Field(type = FieldType.Keyword)
    private String categroy;

    @Field(type = FieldType.Double)
    private Double price;
}
